package main

import (
	"bufio"
	"fmt"
	"net"
	"os"
)

func main() {
	conn, err := net.Dial("tcp", "localhost:777")
	if err != nil {
		fmt.Println("Error connecting:", err)
		return
	}
	defer conn.Close()

	reader := bufio.NewReader(os.Stdin)
	fmt.Print("Enter two numbers separated by a space: ")
	text, _ := reader.ReadString('\n')

	_, err = conn.Write([]byte(text))
	if err != nil {
		fmt.Println("Error writing:", err)
		return
	}

	response := make([]byte, 4096)
	n, err := conn.Read(response)
	if err != nil {
		fmt.Println("Error reading:", err)
		return
	}

	fmt.Println("The quotient of division:", string(response[:n]))
}
